package controllers

import (
	"git.oschina.net/tinkler/for_kmjxc/models/km"
)

// Operaction vip
type VipController struct {
	HelperController
}

// @Title Get vip info
// @Description get vip info by card id or vip name
// @Param keyName path string true "set id or name"
// @Param keyValue path string true "the card's id or vip's name"
// @Success 200 {object} models.km.PosTVipInfo
// @Failure 403 body is empty
// @router /:keyName/:keyValue [get]
func (v *VipController) Get() {
	name := v.GetString(":keyName")
	value := v.GetString(":keyValue")
	switch name {
	case "id":
		{
			v.Data[`json`] = km.GetPosTVipInfoByCardID(value)
		}
	// case "name":
	// 	{
	// 		v.Data[`json`] = km.GetPosTVipInfoByVipName(value)
	// 	}
	case "":
		{
			v.Data[`json`] = map[string]string{"error": "invalid key name set"}
		}
	}
	v.ServeAPI()
}
